package com.curso.lab1.util;

import java.io.InputStream;
import java.util.Properties;

public class Config {

	public static final String PROPERTIES_FILENAME = "labuser.properties";
	public static final String CONN_DB_DRIVER = "connection.driver_class";
	public static final String CONN_DB_URL = "connection.url";
	public static final String CONN_DB_USERNAME = "connection.username";
	public static final String CONN_DB_PASSW = "connection.password";
	public static final String CONN_DB_POOL_SIZE = "connection.pool_size";
	public static final String CONN_DB_DIALECT = "connection.dialect";
	public static final String CONN_DB_SHOW_SQL = "connection.show_sql";
	
	private static final Properties properties = loadProperties();
	
	private static Properties loadProperties() {
		Properties prop = new Properties();
		try {
			InputStream inputFile = ClassLoader.getSystemResourceAsStream(PROPERTIES_FILENAME);
			prop.load(inputFile);
		} catch (Exception e) {
			System.out.println("The properties file can not loaded. The system will be stopped");
			e.printStackTrace();
			System.exit(0);
		} 
		return prop;
	}
	
	public static Properties getProperties() {
		return properties;
	}
	
	
}
